<template>
  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" :height="350" @ok="handleSubmit">
    <AttAdultPointList :flowId="flowId"></AttAdultPointList>
  </BasicModal>

</template>

<script lang="ts" setup>
    import {ref, computed, unref} from 'vue';
    import {BasicModal, useModalInner} from '/@/components/Modal';
    import {BasicForm, useForm} from '/@/components/Form/index';
    import {formSchema} from '../AttAuditFlow.data';
    import {saveOrUpdate} from '../AttAuditFlow.api';
    import AttAdultPointList from '/@/views/attendance/auditflowpoint/AttAdultPointList.vue'
    // Emits声明
    const emit = defineEmits(['register','success']);
    const isUpdate = ref(true);
    const flowId = ref(0);

    //表单赋值
    const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
      setModalProps({confirmLoading: false,showCancelBtn:false,showOkBtn:false});
      if(data.record.id){
        flowId.value=data.record.id;
      }
    });
    //设置标题
    const title = "节点编辑";
    //表单提交事件
    async function handleSubmit(v) {
        try {
            let values = await validate();
            setModalProps({confirmLoading: true});
            //提交表单
            await saveOrUpdate(values, isUpdate.value);
            //关闭弹窗
            closeModal();
            //刷新列表
            emit('success');
        } finally {
            setModalProps({confirmLoading: false});
        }
    }
</script>

<style lang="less" scoped>
	/** 时间和数字输入框样式 */
  :deep(.ant-input-number){
		width: 100%
	}

	:deep(.ant-calendar-picker){
		width: 100%
	}
</style>
